<?php
/**
 * Controller is the customized base controller class.
 * All controller classes for this application should extend from this base class.
 */
class Controller extends CController
{
    public $layout='//layouts/column1';
    private $_assetsUrl = null;
    public $debug = false;
    public $staticsPath;
    public $app_info;
    public $ut;
    protected function beforeAction($action) {
        $this->staticsPath = $this->getAssetsUrl();
        return true;
    }

    public function getAssetsUrl() {
        $assets = Yii::getPathOfAlias('application').DS.'statics'.DS;
        if($this->_assetsUrl === null) {
            if($this->debug === true)
                $this->_assetsUrl = Yii::app()->getAssetManager()->publish($assets, false, -1, true);
            else
                $this->_assetsUrl = Yii::app()->getAssetManager()->publish($assets, false, -1, false);
        }
        return $this->_assetsUrl;
    }
    public function getUt(){
        $this->ut = CHtml::encode(Yii::app()->request->getParam('ut'));
        if(!$this->ut){
            exit('error');
        }
        $this->app_info = CityApp::model()->find('user_token=:user_token and status=:status',array(':user_token'=>$this->ut,'status'=>1));
        if(!$this->app_info){
            exit('error');
        }
    }



}